
package com.gamatechno.solodestinationnew.utils;

import com.gamatechno.solodestinationnew.MainActivity;

public class Webservice {

    private static final String SERVER = "http://sms.gamatechno.com/";
    private static final String ENDPOINT = "solo_destination/services/";
    private static final String ENDPOINT_FILE = "solo_destination/files/";
    private static final String URL = SERVER + ENDPOINT;
    private static final String URL_IMG = SERVER + ENDPOINT_FILE;

    public static final String IMG_ICON_WEATHER = "http://openweathermap.org/img/w/04n.png";
    public static final String GET_WEATHER = "http://api.openweathermap.org/data/2.5/weather?q=Solo,Indonesia&units=metric";
    public static final String GET_FORECAST = "http://api.openweathermap.org/data/2.5/forecast?q=Solo,Indonesia&units=metric";
    public static final String POST_PHOTO_GALLERY = URL + "getPhoto.php";
    public static final String EVENT_FILE = SERVER + ENDPOINT_FILE + "event/";
    public static final String SEARCH_DATA = URL + "getRef.php";
    public static final String REGISTER_GCM = URL + "getRef.php";

    /**
     * get icon weather path
     * 
     * @param iconName
     * @return
     */
    public static String GET_ICON_PATH_WEATHER(String iconName) {
        return "http://openweathermap.org/img/w/" + iconName + ".png";
    }

    public static String GET_SHOPPING(String lang) {
        return URL + "getShopping.php?method=allshopping&format=json&language=" + lang;
    }

    public static String GET_HANDYCRAFT(String lang) {
        return URL + "getHandicraft.php?method=allhandicraft&format=json&language=" + lang;
    }

    /**
     * get All Kuliner
     * 
     * @param lang
     * @return
     */
    public static String GET_KULINER(String lang) {
        return URL + "getKuliner.php?method=allkuliner&format=json&language=" + lang;
    }

    /**
     * get list hotel
     * 
     * @param lang
     * @return
     */
    public static String GET_HOTEL(String lang) {
        return URL + "getHotel.php?method=allhotel&format=json&language=" + lang;
    }

    /**
     * get list wisata
     * 
     * @param lang
     * @return
     */
    public static String GET_WISATA(String lang) {
        return URL + "getWisata.php?method=allwisata&format=json&language=" + lang;
    }

    /**
     * get list photo
     * 
     * @param page
     * @return
     */
    public static String GET_LIST_PHOTO(int page) {
        return URL + "getPhoto.php?method=listPhoto&format=json&page=" + page;
    }

    /**
     * get list photo detail
     * 
     * @param id
     * @return
     */
    public static String GET_LIST_PHOTO_DETAIL(int id) {
        return URL + "getPhoto.php?method=detailPhoto&format=json&gallery_id=" + id;
    }

    /**
     * get list photo detail
     * 
     * @param id
     * @return
     */
    public static String GET_LIST_PHOTO_DETAIL_COMMENT(int id) {
        return URL + "getPhoto.php?method=detailPhotoComment&format=json&gallery_id=" + id;
    }

    /**
     * get Img Path URL
     * 
     * @param category
     * @param imgPath
     * @return
     */
    public static String GET_IMG_DIR(int category, String imgPath) {
        switch (category) {
            case MainActivity.CATEGORY_KULINER:
                return URL_IMG + "kuliner/" + imgPath;
            case MainActivity.CATEGORY_HOTEL:
                return URL_IMG + "hotel/" + imgPath;
            case MainActivity.CATEGORY_TOURISM:
                return URL_IMG + "wisata/" + imgPath;
            case MainActivity.CATEGORY_SHOPPING:
                return URL_IMG + "shopping/" + imgPath;
            case MainActivity.CATEGORY_HANDYCRAFT:
                return URL_IMG + "kerajinan/" + imgPath;
        }
        return null;
    }

    public static String GET_COMMENT_KULINER(int id) {
        return URL + "getKuliner.php?method=getcomment&kuliner_id=" + id + "&format=json";
    }

    public static String GET_COMMENT_HOTEL(int id) {
        return URL + "getHotel.php?method=getcomment&format=json&hotel_id=" + id;
    }

    public static String GET_COMMENT_WISATA(int id) {
        return URL + "getWisata.php?method=getcomment&format=json&wisata_id=" + id;
    }

    public static String GET_COMMENT_SHOPPING(int id) {
        return URL + "getShopping.php?method=getcomment&format=json&belanja_id=" + id;
    }

    public static String GET_COMMENT_HANDYCRAFT(int id) {
        return URL + "getHandicraft.php?method=getcomment&format=json&kerajinan_id=" + id;
    }

    public static String POST_COMMENT_KULINER(String userid, int kuliner_id, float rating,
            String komentar, String name) {
        return URL
                + "getKuliner.php?method=rate&user_id=" + userid + "&kuliner_id=" + kuliner_id
                + "&format=json&rating=" + rating + "&comment=" + komentar + "&name=" + name;
    }

    public static String POST_COMMENT_HOTEL(String userid, int hotel_id, float rating,
            String komentar, String name) {
        return URL + "getHotel.php?method=rate&user_id=" + userid + "&hotel_id=" + hotel_id
                + "&format=json&rating=" + rating + "&comment=" + komentar + "&name=" + name;
    }

    public static String POST_COMMENT_WISATA(String userid, int wisata_id, float rating,
            String komentar, String name) {
        return URL + "getWisata.php?method=rate&user_id=" + userid + "&wisata_id=" + wisata_id
                + "&format=json&rating=" + rating + "&comment=" + komentar + "&name=" + name;
    }

    public static String POST_COMMENT_SHOPPING(String userid, int belanja_id, float rating,
            String komentar, String name) {
        return URL + "getShopping.php?method=rate&user_id=" + userid + "&belanja_id=" + belanja_id
                + "&format=json&rating=" + rating + "&comment=" + komentar + "&name=" + name;
    }

    public static String POST_COMMENT_KERAJINAN(String userid, int wisata_id, float rating,
            String komentar, String name) {
        return URL + "getHandicraft.php?method=rate&user_id=" + userid + "&kerajinan_id="
                + wisata_id
                + "&format=json&rating=" + rating + "&comment=" + komentar + "&name=" + name;
    }

    public static String GET_COMMENT_PHOTO(int id) {
        return URL + "getPhoto.php?method=detailPhotoComment&format=json&gallery_id=" + id;
    }

    public static String GET_EVENT(String lang) {
        return URL + "getEvent.php?method=allevent&format=json&language="
                + lang;
    }

    public static String GET_FB_PHOTO(String fbID) {
        return "http://graph.facebook.com/" + fbID
                + "/picture?redirect=0&height=400&type=normal&width=400";
    }

    // detail search

    public static String GET_DETAIL_SEARCH_KULINER(int id, String lang) {
        return URL + "getKuliner.php?method=kulinerdetail&format=json&language=" + lang + "&id="
                + id;
    }

    public static String GET_DETAIL_SEARCH_HOTEL(int id, String lang) {
        return URL + "getHotel.php?method=hoteldetail&format=json&language=" + lang + "&id="
                + id;
    }

    public static String GET_DETAIL_SEARCH_SHOPPING(int id, String lang) {
        return URL + "getShopping.php?method=shoppingdetail&format=json&language=" + lang + "&id="
                + id;
    }

    public static String GET_DETAIL_SEARCH_KERAJINAN(int id, String lang) {
        return URL + "getHandicraft.php?method=handicraftdetail&format=json&language=" + lang
                + "&id="
                + id;
    }

    public static String GET_DETAIL_SEARCH_WISATA(int id, String lang) {
        return URL + "getWisata.php?method=wisatadetail&format=json&language=" + lang
                + "&id="
                + id;
    }

}
